package com.ypan.uninstall;

import java.io.File;
import java.util.Date;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.util.Log;

public final class ApkInfo {
	public String packageName;
	public String appName;
	public Bitmap icon;
	public String version;
	public int versionCode;
	public String dataDir;
	public long modifiedTime;
	public long apkSize;

	public ApkInfo(String packageName, String appName, Bitmap icon,
			String version, int versionCode, String dataDir,
			long modifiedTime, long apkSize) {
		this.packageName = packageName;
		this.appName = appName;
		this.icon = icon;
		this.version = version;
		this.versionCode = versionCode;
		this.dataDir = dataDir;
		this.modifiedTime = modifiedTime;
		this.apkSize = apkSize;
	}

	public ApkInfo(PackageManager pkManager, PackageInfo pkinfo) {
		packageName = pkinfo.packageName;
		appName = pkManager.getApplicationLabel(pkinfo.applicationInfo)
				.toString();
		icon = ((BitmapDrawable) pkManager
				.getApplicationIcon(pkinfo.applicationInfo)).getBitmap();
		version = pkinfo.versionName;
		versionCode = pkinfo.versionCode;
		dataDir = pkinfo.applicationInfo.dataDir; 
		modifiedTime = pkinfo.lastUpdateTime;
		File apkfile = new File(pkinfo.applicationInfo.publicSourceDir);
		apkSize = apkfile.length();
		//Log.v("Uninstall","path = "+pkinfo.applicationInfo.publicSourceDir);
		//Log.v("Uninstall","modifiedTime = "+modifiedTime);
		//Log.v("Uninstall","apkSize = "+apkSize);
	}
}
